package cn.tedu.egmybatis2.mapper;

import cn.tedu.egmybatis2.pojo.entity.entity.Product1;
import cn.tedu.egmybatis2.pojo.entity.vo.Product1VO1;
import cn.tedu.egmybatis2.pojo.entity.vo.Product1VO2;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface Product1Mapper {
    //@Insert("INSERT INTO product1(price,stock,title) VALUES (#{price},#{stock},#{title})")
    int insertProduct1(Product1 product1);

    //通过id删除一个商品的价格
    //@Delete("DELETE FROM product1 WHERE id=#{id}")
    int deleteProduct1ById(Long id);

    //通过id修改一个商品的价格
    //@Update("UPDATE product1 SET price=#{price},stock=#{stock},title=#{title} WHERE id=#{id}")
    int updateProduct1ById(Product1 product1);

    //通过id查询一个商品的价格和标题
    //@Select("SELECT price,title FROM product1 WHERE id=#{id}")
    Product1VO1 selectProduct1VO1ById(Long id);

    //查询所有商品的标题和库存
    //@Select("SELECT title,stock FROM product1")
    List<Product1VO2> selectProduct1VO2ById(Long id);

    int deleteProduct1ByIds1(List<Long> ids);

    int dynamicUpdate(Product1 product1);

    int countProduct1();


}
